﻿namespace Authentication.Core.Data.DBConfig
{
    using Authentication.Core.Configuration;
    using Authentication.Model.Model;
    using Common.Data.Extensions;
    public class AccountConfiguration : DBConfig<Account>
    {
        public AccountConfiguration()
            : base(SystemConfiguration.Schema, SystemConfiguration.NamingType, SystemConfiguration.TABLE_PREFIX)
        {
            HasKey(k => new { k.Dao, k.UserName });

            //relationship
            HasOptional(t => t.Branch).WithMany(c => c.Accounts).HasForeignKey(t => new { t.BranchCodeSme }).WillCascadeOnDelete(false);
            //HasOptional(t => t.Department).WithMany(c => c.Accounts).HasForeignKey(t => new { t.BranchCodeSme }).WillCascadeOnDelete(false);
        }
    }
}
